Skip to content

improv: Timesketch-worker code health#66

Open
jaegeral wants to merge 3 commits intoopenrelik:mainfrom
jaegeral:2026-02-24_timesketch-worker-improv
Open

improv: Timesketch-worker code health#66
jaegeral wants to merge 3 commits intoopenrelik:mainfrom
jaegeral:2026-02-24_timesketch-worker-improv

Conversation

@jaegeral
Copy link
Copy Markdown
Contributor

@jaegeral jaegeral commented Feb 24, 2026

get_or_create_sketch() Refactor

  • various try, except block
  • input validation

upload() improvement

  • usage of assert() statements to check if all env variables are set
  • make_sketch_public option added and default to false

Note: the tests where written by Gemini

Closes #40

@jaegeral
Copy link
Copy Markdown
Contributor Author

 collected 8 items                                                                                 │
│                                                                                                   │
│ tests/test_tasks.py ........                                             [100%]                   │
│                                                                                                   │
│ ---------- coverage: platform linux, python 3.12.9-final-0 -----------                            │
│ Name              Stmts   Miss  Cover   Missing                                                   │
│ -----------------------------------------------                                                   │
│ src/__init__.py       0      0   100%                                                             │
│ src/app.py            6      6     0%   15-22                                                     │
│ src/tasks.py         74     31    58%   110, 115-116, 187-244                                     │
│ -----------------------------------------------                                                   │
│ TOTAL                80     37    54%

@jaegeral
Copy link
Copy Markdown
Contributor Author

uv run pytest --cov=src --cov-report=term-missing tests/test_tasks.py
========================================== test session starts ==========================================
platform linux -- Python 3.12.9, pytest-9.0.2, pluggy-1.6.0
rootdir: /usr/local/google/home/jaegeral/dev/openrelik-src/openrelik-workers/workers/openrelik-worker-timesketch
configfile: pyproject.toml
plugins: cov-5.0.0
collected 13 items

tests/test_tasks.py .............                                                                 [100%]

---------- coverage: platform linux, python 3.12.9-final-0 -----------
Name              Stmts   Miss  Cover   Missing
-----------------------------------------------
src/__init__.py       0      0   100%
src/app.py            6      0   100%
src/tasks.py         76      1    99%   187
-----------------------------------------------
TOTAL                82      1    99%

@jaegeral jaegeral requested a review from hacktobeer February 24, 2026 13:17
Copy link
Copy Markdown
Contributor

@hacktobeer hacktobeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure all dependencies are added as well.

# limitations under the License.

import os
import requests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this with uv add the pyproject.toml and uv.lock files to this PR.

uv add requests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack need to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge new timesketch worker PR

2 participants